//
//  TQLPwnSingal.h
//  TQLSmartPen
//
//  Created by tql on 2017/10/20.
//  Copyright © 2017年 tqlZj. All rights reserved.
//

/**
 * Author : LW
 * Date Modify: 2020.12.23
 * Content :
 *
 */


#import <Foundation/Foundation.h>
#if TARGET_OS_IOS
#import <UIKit/UIKit.h>
#else
#import <AppKit/AppKit.h>
#endif
#import "TqlBleTimeout.h"
 

/** TQLPenModel ：笔的类型
 * 最好用这个来判断不同的笔，因为这个类型的值是固定的，而笔的名称可能会有变动
 *
 */
typedef NS_ENUM(NSInteger, TQLPenModel) {
    TQLPenModel_Unknown = -1,          //未知类型
    TQLPenModel_0_TQL_101 = 0,          //first pen
    TQLPenModel_1_TQL_111 = 1,          //normal pen
    TQLPenModel_2_TQL_112 = 2,          //custom pen
    TQLPenModel_3_TQL_101A = 3,         //unknown ?
    TQLPenModel_4_TQL_Q01 = 4,          //ios not use
    TQLPenModel_5_PE14_M01 = 5,         //ios not use
    TQLPenModel_6_WB_101 = 6,           //white board pen
    TQLPenModel_7_PT14_WF101 = 7,       //wifi pen
    TQLPenModel_8_130_T41A = 8,        //130-T41A  //原来定义为： TQLPenModel_8_PT14_T101_130
    TQLPenModel_9_130_T31A = 9,         //130-T31A  //原来定义为： TQLPenModel_9_130_T31
    TQLPenModel_10_130_T41 = 10,       //130-T31A
    TQLPenModel_11_130_T31 = 11,       //130-T31A
    TQLPenModel_0X10_TQL_201 = 16       //custom pen
};

@class Dot;
@class ElementCode;

@protocol TQLPenSignal <NSObject>

@optional

#pragma mark --笔状态设置的回调代理
/**
 state 的值与 CB中定义的一一对应
 CBManagerStateUnknown = 0,
 CBManagerStateResetting,
 CBManagerStateUnsupported,
 CBManagerStateUnauthorized,
 CBManagerStatePoweredOff,
 CBManagerStatePoweredOn,
 */
-(void)didUpdatecentralManagerState:(int)state;

/** 连接成功*/
- (void)onConnected:(int)forceMax fwVersion:(NSString *)fwVersion;

/** 连接失败*/
-(void)onConnectFailed;

//写入指令特征更新
-(void)onfinishUpdateCharacteric;

-(void)charactericupdateFail;
/** 断开连接*/
- (void)onDisconnected;

/** get online Dot*/
- (void)onReceiveDot:(Dot *)dot;

#pragma mark -- 属性
/** 1-2 write and get PenName*/
- (void)onPenNameSetupResponse:(BOOL)isSuccess;
- (void)onRecievePenName:(NSString *)PenName;

/** 3 get MAC address*/
- (void)onRecieveMacAdress:(NSString *)MacAdress;

/** 4 get bluetooth firmware Version*/
-(void)onRecievefirmwareVersion:(NSString *)firmwareVersion;

/** 5  get Battery remianed*/
//- (void)onRecieveaBetteryDat;//加上参数是否正在充电，充电状态为False
- (void)onRecieveaBetteryDat:(int)BetteryDat isCharging:(BOOL)isCharging;

/** 6-7 write and get RTC time*/
/** RCT时间设置*/
- (void)onPenTimetickSetupResponse:(BOOL)isSuccess;
-(void)onRecieveRTCTime:(NSString *)RTCTime;

/** 8-9 write and get power off time*/
- (void)onPenAutoShutdownSetUpResponse:(BOOL) isSuccess;
-(void)onRecievePenAutoOffTime:(int)AutoOffTime;

/** 10 Factory Reset */
- (void)onPenFactoryRstSetUpResponse:(BOOL)isSuccess;

/** 11 get Memory used */
-(void)onRecievePenUsedMem:(int)UsedMem;

/** 12-13 write and get Auto power mode*/
- (void)onPenAutoPowerOnSetUpResponse:(BOOL)isSuccess;
- (void)onRecievePenAutoPowerOn:(BOOL)PowerOn;

/** 14-15 write and get beep status
 蜂鸣器：
 result ：0 设置成功, 1 设置失败 ,2 不支持
 */
- (void)onPenBeepSetUpResponse:(int)result;
/*
 PenBeep: 0 ,不响，1，响
 */
- (void)onRecievePenBeep:(BOOL)PenBeep;

/** 16-17 write and get Sensitivity level*/
/*
 *压力水平设置
 Sensitivity：正常值：0~4，  256为不支持时的返回。
*/
- (void)onPenSensitivitySetUpResponse:(int)result;
- (void)onRecievePenSensitivity:(int)Sensitivity;

/**  18-19 write and get LED cokor*/
- (void)onPenLEDColorSetUpResponse:(BOOL)isSuccess;
- (void)onRecievePenLEDColor:(int)LEDColor;

/** 20 Read Sensitivity Correction*/
- (void)onRecievePenSensitivityCorrectionTwentyMin:(NSString *)minCorrection threeHMax:(NSString *)maxSensitivity;

/** 21 get MCU firmware version*/
- (void)onRecievePenMcuFirmwareVersion:(NSString *)McuFirmwareVersion;

/** 22-23 write and get customer id */
- (void)onCustomerIDSetupResponse:(BOOL)isSuccess;//
- (void)onRecievePenCustomerID:(NSString *)CustomerID;//

/** 24-25 write and get element code*/
//- (void)onElementCodeSetUpResponse:(BOOL)isSuccess;不使用已去掉
- (void)onRecievePenElementCode:(ElementCode *)ElementCode;

/** 26 read current Pen Model*/
-(void)onRecieveCurrentPenModel:(NSString *)PenModel;
-(void)onRecieveCurrentPenModelType:(TQLPenModel )PenModelType;


/** 27-28 write/read current code-point type*/
//- (void)onCurrentCodePointTypeSetupResponse:(BOOL)isSuccess;不使用已去掉
//-(void)onRecieveCurrentCodePointType:(NSString *)codePoint;

/** 29 read if it is compress type*/
//-(void)onRecieveIfIsCompressType:(BOOL)CompressType;不使用已去掉

/** 30-31 write/read LED config open r close*/
- (void)onLEDConfigSetupResponse:(BOOL)isSuccess;
-(void)onRecieveLEDConfig:(BOOL)LEDConfig;

/** 32 Set APP Handwriting color*/
- (void)onHandwritingColorSetupResponse:(int)color;

/** 33 APP Set OID Value*/
//- (void)onOIDValueSetupResponse:(BOOL)isSuccess;不使用已去掉

/** 34 Set BLE Enter OTA Mode*/
- (void)onEnterOTAModeSetupResponse:(BOOL)isSuccess;//仅201 和112有效

/** 35 Set MacAddress*/
//- (void)onMacAddressSetupResponse:(BOOL)isSuccess;不使用已去掉
/** 36 ReadOIDValue*/

//- (void)onRecieveOIDValue:(NSString *)OIDValue;不使用已去掉

//38、读取MCU UINQUE CODE  读取MCU唯一ID码 仅限有线笔使用
//39、心跳 APP每2s下发心跳命令，用于MCU连接判断 仅限有线笔使用

//40、Set APP Erase Mode 笔设置APP是否进入板擦模式 仅限白板笔 调用此接口需要判断笔类型
- (void)onEnterEraseMode:(BOOL)isSuccess;

//41、Set MCU Setting MCU相关设置信息，多功能协议  也可以读取 0/1写, 2读
-(void)onMCUInfoSettingWriteFloatingMode:(BOOL)isSuccess;//是否写成功

//-(void)onMCUInfoSettingReadFloatingMode:(BOOL)isSuccess;//是否读取成功



#pragma -- mark offlineData
- (void)onOfflineDataList:(int)offlineNotes;
/** 开始加载离线数据*/
- (void)onStartOfflineDownload:(BOOL)isSuccess;
/** 停止加载离线数据*/
- (void)onStopOfflineDownload:(BOOL)isSuccess;
/** 暂停加载离线数据*/
- (void)onPauseOfflineDownload:(BOOL)isSuccess;
/** 继续加载离线数据*/
- (void)onContinueOfflineDownload:(BOOL)isSuccess;
/** 加载离线数据完成*/
- (void)onFinishedOfflineDownload:(BOOL)isSuccess;
/** 离线数据的进度条*/
-(void)offlineStrokesProgress:(int)progress;
/** 删除离线数据*/
-(void)onDeleteOfflineData:(BOOL)isSuccess;
/** 接收离线数据*/
- (void)onReceiveOfflineStrokes:(Dot *)dot;

/** get dot config data*/
- (void)onReceivePenStatus:(NSString *)timetick
                   PenName:(NSString *)penName
                   MacAdress:(NSString *)macAdress
                  forcemax:(int)forcemax
                   battery:(int)battery
                   usedmem:(int)usedmem
             autopowerMode:(BOOL)autopowerMode
                      beep:(BOOL)beep
          autoshutdownTime:(short)autoshutdownTime
            penSensitivity:(short)penSensitivity
                  penColor:(int)penColor
               ComstomerID:(NSString *)ComstomerID
                  PenModel:(NSString *)penModel
              offlineDataList:(int)dataList;


#pragma mark -- other
//revieveArchiveElementCode、PenNote封存笔迹使用不使用已去掉
//-(void)onRecieveArchiveElementCode:(NSString *)str;

//离线数据颜色改变

#if TARGET_OS_IOS
-(void)offlineDataColorChange:(UIColor *)offlineDataColor;
#else
-(void)offlineDataColorChange:(NSColor *)offlineDataColor;

#endif
//超时回调
-(void)requestOrTComandTimeout:(TQLComandTimeoutType)timeoutType;

@end

